package handler

import (
	"net/http"

	"backend/internal/middleware"
	"backend/internal/svc"
	"github.com/zeromicro/go-zero/rest"
)

func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/api/funds",
				Handler: middleware.Cors(GetFundListHandler(serverCtx)),
			},
			{
				Method:  http.MethodGet,
				Path:    "/api/funds/:id",
				Handler: middleware.Cors(GetFundDetailHandler(serverCtx)),
			},
			{
				Method:  http.MethodGet,
				Path:    "/api/funds/:fundId/performance",
				Handler: middleware.Cors(GetFundPerformanceHandler(serverCtx)),
			},
			{
				Method:  http.MethodGet,
				Path:    "/api/funds/:fundCode/scorecard",
				Handler: middleware.Cors(GetFundScoreCardHandler(serverCtx)),
			},
		},
		rest.WithPrefix(""),
	)
}
